Python 프로그램을 실행하는 방법에는 여러 가지가 있다. 아래는 Anaconda에서 실행하는 방법이다.
1) Anaconda Prompt 실행
2) Python 파일이 있는 디렉토리로 이동
cd C:\Users\사용자명\Desktop\test
3) Python 파일 실행
python script.py
1) Anaconda Prompt 또는 Terminal에서 IPython 실행
ipython
2) 파일 실행 (현재 디렉토리에 있는 경우)
%run script.py
1) Anaconda Navigator에서 Spyder 실행 또는 spyder
명령어로 실행
2) 파일 메뉴 → test.py 파일 열기
3) 상단 ▶ 버튼 클릭 또는 F5
키를 눌러 실행
4) IPython 콘솔에서 결과 확인 가능
Python 프로그램을 실행 파일로 변환하려면 PyInstaller
를 사용할 수 있다.
다음 명령어를 입력하여 PyInstaller를 설치한다.
conda install pyinstaller
아래 명령어를 입력하면 실행 파일이 생성된다.
pyinstaller --onefile script.py
위 명령을 실행하면 dist
폴더에 실행 파일이 생성된다.
완성된 실행 파일을 다운로드할 수 있다.